<?php namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;


/**
 * App\Phases
 *
 * @property integer $id
 * @property string $phase
 * @property string $deleted_at
 * @property \Carbon\Carbon $created_at
 * @property \Carbon\Carbon $updated_at
 * @method static \Illuminate\Database\Query\Builder|\App\Phases whereId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Phases wherePhase($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Phases whereDeletedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Phases whereCreatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Phases whereUpdatedAt($value)
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\investOrg[] $investorg_x_phase
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Investor[] $investor_x_phase
 * @property-read \App\Project $project
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Investor[] $investor_x_phases
 */
class Phases extends Model{
    protected $table = 'phases';
    protected $fillable  = ['id', 'phase'];
    use SoftDeletes;

    /** 关联投资机构-投资阶段 */
    public function investorg_x_phase()
    {
        return $this->belongsToMany('App\InvestOrg' , 'phase_relations' , 'phase_id' , 'org_id');
    }

    /** 关联投资人-投资阶段 */
    public function investor_x_phases()
    {
        return $this->belongsToMany('App\Investor','phase_relations','phase_id','investor_id');
    }

    /** 关联项目 - 融资阶段 */
    public function project()
    {
        return $this->hasOne('App\Project' , 'phase_id');
    }





}